<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <script type="text/javascript" language="javascript">
            function confirmDelete(){
                if (confirm("Voulez-vous supprimmer la(es) cuisine(s) s&eacute;lectionn&eacute;e(s) ?"))
                    return true;
                return false;
            }
        </script>
        <link href="../resources/css/style.css" rel="stylesheet" type="text/css" media="screen" />
        <title>Liste des Cuisines</title>
    </h:head>
    <h:body>
        <header>
           <div class="container"><a href="../resources/login.faces" class="login">Login</a>
              <nav>
                 <ul>
                    <li><a href="../default.htm" class="active"><span><span>Accueil</span></span></a></li>
                    <li><a href="../resources/listRestaurants.faces"><span><span>Restaurants A-Z</span></span></a></li>
                 </ul>
              </nav>
              <h1><a href="../default.htm">Restaurant review</a></h1>
              <div class="slogan"></div>
           </div>
        </header>
        <ul>
            <li><h:outputText value="Bienvenue #{securityController.connectedUserid}"/></li>
            <li><h:form><h:commandLink action="#{securityController.logout}" value="Se d&eacute;connecter"/></h:form></li>
        </ul>
        <hr/>
        <h1>Liste des cuisines</h1>
        <hr/>
        <h:form>
            <h:dataTable value="#{cuisineController.cuisineList}" var="cu" border="1">
                <h:column>
                    <h:selectBooleanCheckbox value="#{cu.selected}"/>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="ID :"/>
                    </f:facet>
                    <h:commandLink action="#{cuisineController.viewDetail}" value="#{cu.id}"/>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Nom"/>
                    </f:facet>
                    <h:commandLink action="#{cuisineController.viewDetail}" value="#{cu.title}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="region"/>
                    </f:facet>
                    <h:outputText value="#{cu.region}"/>
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="type"/>
                    </f:facet>
                    <h:outputText value="#{cu.type}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Description"/>
                    </f:facet>
                    <h:outputText value="#{cu.description}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="image(url)"/>
                    </f:facet>
                    <h:outputText value="#{cu.img}" />
                </h:column>

            </h:dataTable>

            <h:commandButton action="#{cuisineController.doNew}" rendered="#{securityController.connectedUserIsRegistered}" value="Creer cuisine"/>
            <h:outputText value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"/>
            <h:commandButton action="#{cuisineController.doDelete}" rendered="#{securityController.connectedUserIsRegistered}" onclick="return confirmDelete();" value="Supprimer" />
        </h:form>
        <hr/>
    </h:body>
</html>
